from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.faker import Faker

#不用去写，因为这是现成的代码，但是要看懂
#这就是下面那句话所得到的结果
data = [['衬衫1' , 100],['衬衫2' , 200],['衬衫3' , 300],['衬衫4' , 400],['衬衫5' , 500],['衬衫6' , 138],['衬衫7' , 600],]
c = (
    Pie()
    # .add("", [list(z) for z in zip(Faker.choose(), Faker.values())])
    .add("", data)
    .set_colors(["blue", "green", "yellow", "red", "pink", "orange", "purple"])
    .set_global_opts(title_opts=opts.TitleOpts(title="Pie-商品销售情况"),toolbox_opts=opts.ToolboxOpts(is_show=True , orient="vertical"))
    .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
    .render("pie_set_color.html")
)

#[['周一', 136], ['周二', 59], ['周三', 40], ['周四', 107], ['周五', 41], ['周六', 81], ['周日', 120]]
print([list(z) for z in zip(Faker.choose(), Faker.values())])

